package main

import (
	"fmt"
	"github.com/garyburd/redigo/redis"
)

func main(){
	conn,err := redis.Dial("tcp","127.0.0.1:6379",redis.DialPassword("jinmingzhi"))
	if err != nil {
		fmt.Printf("连接失败：%s",err)
		return
	}
	defer conn.Close()

	_,err = conn.Do("set","name","jmz1")
	if err != nil {
		fmt.Printf("设置失败：%s\n",err);
		return
	}

	name,err := conn.Do("get","name")
	if err != nil{
		fmt.Printf("获取失败：%s\n",err)
		return
	}

	fmt.Println(redis.String(name,nil))
}
